﻿using LKVMLMLib;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace TrucTiepService
{
    public partial class TrucTiepEntities : DbContext
    {
        public TrucTiepEntities(string connection_string)
            : base(connection_string)
        {
        }
        public static TrucTiepEntities initTrucTiepEntities(string domain)
        {
            using (var db = new CompanyEntities())
            {
                string connection_string = db.Licences.Where(w => w.Domain == domain).Select(w => w.DatabaseConectionString).SingleOrDefault();
                connection_string = connection_string.Replace("DuAnDaCap", "TrucTiepModel");
                return new TrucTiepEntities(connection_string);

            }
        }
    }
}